<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>

<script type="text/javascript">
	function sparepartCategoryTree_onNodeClick(event, treeId, treeNode) {

		sparepartGrid.search({
			"field" : "treenode_path",
			"op" : "bw",
			"data" : treeNode.treenodePath
		});
	}
	
	function getSparepartCategoryTreeNode() {
		var nodes = sparepartCategoryTree.zTree.getSelectedNodes();

		if (nodes  && nodes != "") {
			return "categoryId=" + nodes[0].id;
		}
		
		isperp.alert("请选择节点！");
		return false;
	}
</script>

<div class="box no-border">
	<div class="box-left">
		<isperp:tree id="sparepartCategoryTree" modal="false" title="备件分类">
			<isperp:async enable="true" url="sparepart/category/getTree">
			</isperp:async>
			<isperp:callback onClick="sparepartCategoryTree_onNodeClick">
			</isperp:callback>
		</isperp:tree>
	</div>
	<div class="box-right">
		<div class="box no-border">
		
			<isperp:grid gridId="sparepartGrid"
				url="sparepart/sparepart/listDetail" gridTitle="${pageTitle}" editOrDeleteRightControl="true"
				cusEditUrl="sparepart/sparepart/edit" cusFormatterActions="true"
				cusDeleteUrl="sparepart/sparepart/delete"
				ondbClickRowEvent="sparepartGrid.edit(rowid);"
				beforeCreateAction="getSparepartCategoryTreeNode();">
				<jsp:attribute name="searchbar">	
				<table class="form-table">
						<tbody>
							<tr>
								<td align="right">编号：</td>
								<td><input type="text" field="code" op="cn">
								</td>
								<td align="right">名称：</td>
								<td><input type="text" field="name" op="cn">
								</td>
								<td align="right">设别号/PN号：</td>
								<td><input type="text" field="devide_number" op="cn">
								</td>
							</tr>
						</tbody>
					</table> 
				</jsp:attribute>
				<jsp:attribute name="toolbar">
				<isperp:toolbar id="userToolbar">
					<%-- <isperp:button id="sparepartGridCeate" icon="icon-plus" text="新增备件"
							cssClass="nui-mainbtn" onclick="sparepartGrid.create();"></isperp:button> --%>
				</isperp:toolbar>	
				</jsp:attribute>
				<jsp:body> 
					<isperp:column name="id" title="id" hidden="true"></isperp:column> 
					<isperp:column name="code" title="编号" width="120">
					</isperp:column>
					<isperp:column name="name" title="名称" width="90">
					</isperp:column> 
					<isperp:column name="devide_number" title="设备号/PN号" width="100">
					</isperp:column> 
					<isperp:column name="stock_in_date" title="入库日期" width="120" formatter="date">
					</isperp:column>
					<%-- <isperp:column name="use_staff_name" title="责任人" width="120">
					</isperp:column> --%>
					<isperp:column name="support_staff_name" title="使用人" width="100">
					</isperp:column>
					<isperp:column name="location" title="位置" width="120">
					</isperp:column> 
					<%-- <isperp:column name="project_name" title="项目" width="120">
					</isperp:column> --%>
					<isperp:column name="status" title="状态" width="120">
					</isperp:column> 
			</jsp:body>
			</isperp:grid>
		</div>
		<isperp:operate code="COMMON_TREE_LIST_HELP"></isperp:operate>
	</div>
</div>